package com.xuecheng.content.api;


import com.xuecheng.execption.ValidationGroups;
import com.xuecheng.model.po.CourseTeacher;
import com.xuecheng.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author 小班哥
 * @version 1.0
 * @date 2023/3/19 15:58
 * @description 课程师资信息接口
 */

@Api(value = "课程师资查询/编辑接口" , tags = "课程师资查询/编辑接口")
@RestController
@Slf4j
public class TeachplanTeacherController {
    @Autowired
    private CourseTeacherService courseTeacherService;

    @ApiOperation("课程师资相应师资")
    @GetMapping("courseTeacher/list/{courseID}")
    public List<CourseTeacher> SelectTeacher(@PathVariable long courseID){
        return courseTeacherService.courseTeacherInfo(courseID);
    }

    @ApiOperation("新增课程讲师")
    @PostMapping("/courseTeacher")
    public void addCourseTeacher(@Validated @RequestBody CourseTeacher courseTeacher){
        courseTeacherService.AddTeacher(courseTeacher);
    }

    @ApiOperation("删除课程对应讲师")
    @DeleteMapping(value = "/courseTeacher/course/{TeacherID}/{id}")
    public void DeleteTeacher(@PathVariable long TeacherID, @PathVariable  long id){
        courseTeacherService.DeleteTeacherInfo(TeacherID , id);
    }


}
